<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>主播开播界面</title>
</head>
<body>
<!--如何使用浏览器调用设备的摄像头并且能够获取到他的数据展示出来-->
<video src="" id="vi" autoplay style="width:640px;height:480px;"></video>
<!--webrtc-->
<script type="text/javascript">
    function draw(){
        // js bom模型
        navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;

        navigator.getUserMedia({video:true,audio:true},success,console.log);

    }

    var success = function (stream) {
        document.getElementById("vi").src = window.URL.createObjectURL(stream);
    };

    draw();
</script>
</body>
</html>